
import java.util.HashSet;
import java.util.Set;

/**
 * Created With IntelliJ IDEA
 * Description:leetcode:217. 存在重复元素
 * <a href="https://leetcode.cn/problems/contains-duplicate/">...</a>
 * User: DELL
 * Data: 2023-03-05
 * Time: 0:03
 */
public class Solution {
    public boolean containsDuplicate(int[] nums) {
        Set<Integer> hashSet = new HashSet<>();
        for (int num : nums) {
            if (!hashSet.contains(num)) {
                hashSet.add(num);
            } else {
                return true;
            }
        }
        return false;
    }
}